package cn.com.surker.sale.dao;

import cn.com.surker.sale.entity.SaleBillPayment;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 销售项目累计结算表 Mapper 接口
 * </p>
 *
 * @author admin
 * @since 2024-05-27
 */
public interface SaleBillPaymentDao extends BaseMapper<SaleBillPayment> {

    List<Map<String, Object>> findToday();

    /**
     * 查询合同
     * @param today
     * @param conId
     * @return
     */
    SaleBillPayment findByContract(String today, Long conId);

    /**
     * 查询当个项目累计结算
     * @param conId
     * @param today 查询小于等于此统计月份的月统计
     * @return
     */
    SaleBillPayment findTotalContract(Long conId, String today);

    /**
     * 查询合同总数
     * @param searchVal
     * @param sales
     * @param status
     * @param orgId
     * @return
     */
    Integer findSumContractTotal(String searchVal, String sales, Integer status, Integer workStatus,
                                 Long orgId, String startMonth, String endMonth);

    /**
     * 分页查询合同数据
     * @param searchVal
     * @param sales
     * @param status
     * @param orgId
     * @param offset
     * @param limit
     * @return
     */
    List<Map<String, Object>> findSumContract(String searchVal, String sales, Integer status, Integer workStatus,
                                              Long orgId, String startMonth, String endMonth, Integer offset, Integer limit);

	/**
	 * 查询到截止月的结算信息
	 *
	 * @param conId
	 * @param month
	 * @return
	 */
	SaleBillPayment findEndMonth(Long conId, String month);
}
